/**

 * 版权所有(C)，上海勾芒信息科技，2017，所有权利保留。
 *
 * 项目名：cards-web 
 * 文件名：:GoalPlanConvert.java
 * 模块说明：	
 * 修改历史：
 * 2018年4月6日 - liyang - 创建。
 *
 */
package com.alex.insistence.rest.goal.convert;

import org.springframework.core.convert.converter.Converter;

import com.alex.insistence.rest.goal.GoalPlanDTO;
import com.alex.insistence.web.cgform.goal.plan.entity.GoalPlanEntity;

/**
 * @author:liyang
 * @time:2018年4月6日 下午2:24:18
 * @since:1.0
 */
public class GoalPlanConvert implements Converter<GoalPlanDTO, GoalPlanEntity> {

  private static GoalPlanConvert instance;

  public static GoalPlanConvert getInstance() {

    if (instance == null) {
      instance = new GoalPlanConvert();
    }
    return instance;
  }

  @Override
  public GoalPlanEntity convert(GoalPlanDTO source) {
    if (source == null) {
      return null;
    }
    GoalPlanEntity target = new GoalPlanEntity();
    target.setId(source.getId());
    target.setTitle(source.getTitle());
    target.setContent(source.getContent());
    target.setBeginDate(source.getBeginDate());
    target.setEndDate(source.getEndDate());
    target.setCycle(source.getCycle());
    target.setType(source.getType());
    target.setStatus(source.getStatus());
    target.setTag(source.getTag());
    return target;
  }

}
